<!-- 个人中心页面 -->
<script setup>
import { computed } from 'vue'
import { useAuthStore } from '../store/auth'

const authStore = useAuthStore()
const userInfo = computed(() => authStore.userInfo)
</script>

<template>
  <div class="profile">
    <div class="profile-card">
      <div class="profile-header">
        <el-avatar :src="userInfo.avatar" :size="80">
          {{ userInfo.name?.charAt(0) }}
        </el-avatar>
        <div class="profile-info">
          <h2>{{ userInfo.name }}</h2>
          <p>角色：{{ userInfo.role }}</p>
          <p>用户名：{{ userInfo.username }}</p>
        </div>
      </div>
      
      <div class="profile-content">
        <el-descriptions title="个人信息" :column="2" border>
          <el-descriptions-item label="姓名">{{ userInfo.name }}</el-descriptions-item>
          <el-descriptions-item label="用户名">{{ userInfo.username }}</el-descriptions-item>
          <el-descriptions-item label="角色">{{ userInfo.role }}</el-descriptions-item>
          <el-descriptions-item label="ID">{{ userInfo.id }}</el-descriptions-item>
        </el-descriptions>
      </div>
    </div>
  </div>
</template>

<style scoped>
.profile {
  padding: 24px;
  display: flex;
  justify-content: center;
}

.profile-card {
  background: white;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 700px;
}

.profile-header {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #eee;
}

.profile-info {
  margin-left: 24px;
}

.profile-info h2 {
  margin: 0 0 12px;
  font-size: 24px;
  color: #333;
}

.profile-info p {
  margin: 6px 0;
  color: #666;
  font-size: 14px;
}
</style>